<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>用户仪表板</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.2.3/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <style>
        .sidebar {
            position: fixed;
            top: 0;
            bottom: 0;
            left: 0;
            z-index: 100;
            padding: 48px 0 0;
            box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
            width: 280px;
            background-color: #f8f9fa;
        }

        .sidebar-sticky {
            position: relative;
            top: 0;
            height: calc(100vh - 48px);
            padding-top: .5rem;
            overflow-x: hidden;
            overflow-y: auto;
        }

        .sidebar .nav-link {
            font-weight: 500;
            color: #333;
            padding: 1rem;
            display: flex;
            align-items: center;
        }

        .sidebar .nav-link i {
            margin-right: 0.5rem;
            width: 20px;
            text-align: center;
        }

        .sidebar .nav-link:hover {
            background-color: #e9ecef;
            color: #007bff;
        }

        .sidebar .nav-link.active {
            color: #007bff;
            background-color: #e9ecef;
        }

        .main-content {
            margin-left: 280px;
            padding: 48px 36px;
        }

        .welcome-banner {
            background: linear-gradient(135deg, #6B73FF 0%, #000DFF 100%);
            color: white;
            padding: 2rem;
            border-radius: 1rem;
            margin-bottom: 2rem;
        }

        .feature-card {
            transition: transform 0.2s;
            height: 100%;
            cursor: pointer;
        }

        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }

        .feature-icon {
            font-size: 2rem;
            margin-bottom: 1rem;
            color: #007bff;
        }

        .user-info {
            padding: 1rem;
            border-bottom: 1px solid #dee2e6;
            margin-bottom: 1rem;
        }

        .user-info .username {
            font-size: 1.2rem;
            font-weight: 500;
            margin-bottom: 0.5rem;
        }
    </style>
</head>
<body data-user-role="customer">
    <!-- 引入增强版全局通知组件 -->
    <div th:replace="~{common/enhanced-global-notification :: notification}"></div>
    
    <!-- 侧边栏 -->
    <nav class="sidebar">
        <div class="sidebar-sticky">
            <div class="user-info">
                <div class="username" th:text="${username}">用户名</div>
                <a href="/logout" class="btn btn-outline-danger btn-sm">
                    <i class="fas fa-sign-out-alt"></i> 退出登录
                </a>
            </div>

            <!-- 主要功能 -->
            <div class="nav-section mb-3">
                <h6 class="sidebar-heading px-3 mt-4 mb-1 text-muted">主要功能</h6>
                <ul class="nav flex-column">
                    <li class="nav-item">
                        <a class="nav-link active" href="/customer/dashboard">
                            <i class="fas fa-home"></i> 主页
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/customer/products">
                            <i class="fas fa-shopping-bag"></i> 商品浏览
                        </a>
                    </li>
                </ul>
            </div>

            <!-- 开发中的功能 -->
            <div class="nav-section">
                <h6 class="sidebar-heading px-3 mt-4 mb-1 text-muted">更多功能</h6>
                <ul class="nav flex-column">
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/customer/cart}">
                            <i class="fas fa-shopping-cart"></i> 购物车
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/customer/orders}">
                            <i class="fas fa-file-invoice"></i> 订单管理
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/customer/wishlist">
                            <i class="fas fa-heart"></i> 收藏夹
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/customer/profile">
                            <i class="fas fa-user-circle"></i> 个人资料
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/address/list(userId=${username})}">
                            <i class="fas fa-map-marker-alt"></i> 地址管理
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/customer/customer-service">
                            <i class="fas fa-headset"></i> 联系客服
                        </a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <!-- 主要内容区 -->
    <main class="main-content">
        <!-- 欢迎横幅 -->
        <div class="welcome-banner">
            <h2>欢迎回来，<span th:text="${username}">用户</span></h2>
            <p class="mb-0">这里是您的个人中心，可以浏览商品、管理订单。</p>
        </div>

        <!-- 功能卡片 -->
        <div class="row g-4">
            <div class="col-md-6">
                <div class="card feature-card">
                    <div class="card-body">
                        <div class="feature-icon">
                            <i class="fas fa-shopping-bag"></i>
                        </div>
                        <h5 class="card-title">商品管理</h5>
                        <p class="card-text">浏览和管理您的商品。</p>
                        <a href="/customer/products" class="btn btn-primary">查看商品</a>
                    </div>
                </div>
            </div>

        </div>
    </main>

    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.2.3/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/js/all.min.js"></script>
</body>
</html>